home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000112_icon-group-sender _Sat Dec 4 22:31:04 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  2KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 14 Dec 1993 17:09:02 MST
  2. Article: 2309 of comp.lang.icon
  3. Path: CS.Arizona.EDU!not-for-mail
  4. From: nevin@cs.arizona.edu (Nevin Liber)
  5. Newsgroups: comp.lang.icon
  6. Subject: Re: two language questions
  7. Date: 4 Dec 1993 22:31:04 -0700
  8. Organization: University of Arizona CS Department, Tucson AZ
  9. Lines: 41
  10. Message-Id: <2drrmo$iu3@caslon.CS.Arizona.EDU>
  11. References: <CGxEnw.Lwq@walter.bellcore.com> <CH8Dno.9IM@walter.bellcore.com> <2dd1v7$p98@caslon.cs.arizona.edu> <CHA02z.4r1@walter.bellcore.com>
  12. Nntp-Posting-Host: caslon.cs.arizona.edu
  13. Status: RO
  14. Errors-To: icon-group-errors@cs.arizona.edu
  15. Apparently-To: icon-group-addresses
  16.  
  17. In article <CHA02z.4r1@walter.bellcore.com>,
  18. Norman Ramsey <norman@flaubert.bellcore.com> wrote:
  19. > I, Nevin Liber, nevin@cs.arizona.edu,  wrote:
  20. NL> If you believe otherwise, please post a code fragment where you can do
  21. NL> something useful with "inserted elements might or might not be
  22. NL> generated" as the semantics vs "undefined" as the semantics.
  23.  
  24. NR> Under the invariant that no value in t has type integer,
  25. NR> 
  26. NR>   every type(x := !s) == "integer" do insert(s, t[x])
  27. NR> 
  28. NR> is safe and well defined in the maybe, maybe not semantics.
  29.  
  30. You're right.  I concede.  If you have a way to ignore (at least) all
  31. elements that were not in the original set (ie, degenerate the "maybe /
  32. maybe" not semantics to the stronger "definitely not" semantics), this
  33. is a perfectly well defined concept.  Very clever.
  34.  
  35. NR> In the
  36. NR> undefined semantics it's unsafe and I'm forced to write
  37.  
  38. NR>   ss := set()
  39. NR>   every type(x := !s) == "integer" do insert(ss, t[x])
  40. NR>   every insert(s, !ss)
  41.  
  42. Actually, I would change the last line to s ++:= ss, and I would claim
  43. that these three lines are more readable/understandable/maintainable
  44. than the one-liner (although this is an orthogonal issue to the
  45. original discussion), although certainly not as space-efficent.
  46. Personally, I like code that doesn't rely on hidden dependencies (such
  47. as the fact that t has no integer values in the above example).  But I
  48. digress.
  49.  
  50. Now that I think about it, if I needed time-efficiency, I might implement
  51. the above three lines as:
  52.  
  53.     l := list()
  54.     every "integer" == type(x := !s) do put(l, t[x])
  55.     s ++:= set(l)
  56. -- 
  57.     Nevin ":-)" Liber    nevin@cs.arizona.edu    (602) 293-2799
  58.  
  59.